package com.springboot.custom;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

/**
 * matchIfMissing: 默认为false。当不存在指定属性时，是否直接视为符合(也就是直接加载)
 *
 * @author yexi
 */
@ConditionalOnProperty(prefix = "config", name = "enabled", havingValue = "true", matchIfMissing = true)
@Component
@Setter
@Getter
public class ConditionalDemo {

    static {
        System.out.println("此ConditionalDemo类被成功载入内存");
    }

    public ConditionalDemo() {
        System.out.println("此ConditionalDemo类被成功加载并创建Bean: " + this);
    }

}
